using System.Collections.Specialized;
using System.Xml;
using RaisingStudio.Data.Common.Configuration;
using RaisingStudio.Common.Xml;

namespace RaisingStudio.Data.Common.Managers
{
	/// <summary>
    /// Summary description for DefinitionDeSerializer.
	/// </summary>
    public sealed class DefinitionDeSerializer
	{
		/// <summary>
        /// Deserialize a Definition object
		/// </summary>
		/// <param name="node"></param>
		/// <param name="configScope"></param>
		/// <returns></returns>
        public static Definition Deserialize(XmlNode node)
		{
            Definition definition = new Definition();

			NameValueCollection prop = NodeUtils.ParseAttributes(node);
            definition.Name = NodeUtils.GetStringAttribute(prop, "name");
            definition.Resource = NodeUtils.GetStringAttribute(prop, "resource");
            definition.Embedded = NodeUtils.GetStringAttribute(prop, "embedded");
            definition.Url = NodeUtils.GetStringAttribute(prop, "url");

            return definition;
		}
	}
}
